/*******************************************
 * Copyright 2007 Aphrodite Framework for javaME .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * Email : owner@aphroditeme.dev.java.net
 * Contributors:
 *     Kent Elton - initial API and implementation
 *******************************************/

package com.aphrodite.ui.bg;

import javax.microedition.lcdui.Graphics;

/**
 * Combination of two backgrounds
 * 
 * @author kentelt
 * 
 */
public final class HybridBackground extends Background {
	private Background bg1;
	private Background bg2;

	/**
	 * Combine two backgrounds.
	 * 
	 * @param bg1
	 *            first background. Rendered first!
	 * @param bg2
	 *            second background
	 */
	public HybridBackground(Background bg1, Background bg2) {
		super();
		this.bg1 = bg1;
		this.bg2 = bg2;
	}

	public void cleanUp() {
		bg1 = null;
		bg2 = null;
	}

	public void render(Graphics g) {
		bg1.render(g);
		bg2.render(g);
	}

	public void setHeight(int height) {
		bg1.setHeight(height);
		bg2.setHeight(height);
	}

	public void setWidth(int width) {
		bg1.setWidth(width);
		bg2.setWidth(width);
	}

	public void setX(int x) {
		bg1.setX(x);
		bg2.setX(x);

	}

	public void setY(int y) {
		bg1.setY(y);
		bg2.setY(y);
	}

}
